function Add-ADSStream
{
    <#
        .SYNOPSIS
            Add a new ADS stream to a file.
 
        .DESCRIPTION
            This function takes a file path, adds a new stream and value.
 
        .EXAMPLE
            Add-ADSStream -Path C:\data\Documents\Powershell\test\ADS\adstest.txt -StreamName 'New Stream' -Value 'Something sneaky'
 
            This example demonstrates how to add a new stream called 'New Stream' with a value of 'Something sneaky'
            to an existing file, C:\data\Documents\Powershell\test\ADS\adstest.txt.
 
        .PARAMETER Path
            This mandatory string parameter indicates the path the file being modified.
 
        .PARAMETER Streamname
            This mandatory string indicates the name of the new alternate data stream.
 
        .PARAMETER Value
            Thi mandatory string indicates theb alue to be stored in the ADS.
 
        .INPUTS
            System.String
 
        .OUTPUT
            Void.
    #>
 
    [CmdletBinding()]
    param(
        [Parameter(
            Mandatory = $true,
            Position = 0,
            ValueFromPipeline = $true
        )]
        [System.String]
        $Path,
 
        [Parameter(
            Mandatory = $true,
            Position = 1
        )]
        [System.String]
        $StreamName,
 
        [Parameter(
            Mandatory = $true,
            Position = 2
        )]
        [System.String]
        $Value
    )
 
    # The Add-Content cmdlet allows you to add a new value to an alteranate
    # data stream within the file.
    Add-Content -Path $Path -Stream $StreamName -Value $Value;
} # end function Add-ADSStream

function Get-ADSStream 
{
    <#
        .SYNOPSIS
            Get an alternate data streams from a file (or files).

        .DESCRIPTION
            This function examines a file (or file set) for alternate data streams
            to identify "hidden" data.

        .EXAMPLE
            Get-ADSStream -Path C:\data\Documents\Powershell\test\ADS\adstest.txt -StreamName 'New Stream' -Value 'Something sneaky'

            This example demonstrates how to add a new stream called 'New Stream' with a value of 'Something sneaky'
            to an existing file, C:\data\Documents\Powershell\test\ADS\adstest.txt.

        .PARAMETER FilePath
            This mandatory string parameter indicates the path the file being examined.

        .INPUTS 
            System.String

        .OUTPUT
            System.String
    #>

    [CmdletBinding()]
    param(
        [Parameter(
            Mandatory = $true,
            Position = 0,
            ValueFromPipeline = $true
        )]
        [System.String[]]
        $FilePath
    )

    Process {
        Get-Item -Path $FilePath -Stream *
    }
} # end function Get-ADSStream

function Read-ADSStream
{
    <#
        .SYNOPSIS
            Read an alternate data stream's value from a file (or files).
 
        .DESCRIPTION
            This function examines a file's alternate data stream by name
            to read its value
               
        .EXAMPLE
            Read-ADSStream -FilePath C:\Data\Documents\Powershell\test\ADS\adstest.txt -StreamName 'Another'
 
            Another ADS stream
 
            This example reads an alternate data stream named Another and returns its value.
 
        .LINK
            http://rkeithhill.wordpress.com/2012/03/04/powershell-v3-betabetter-ntfs-alternate-data-stream-handling/
 
        .PARAMETER FilePath
            This mandatory string parameter indicates the path the file being examined.
 
        .INPUTS
            System.String
 
        .OUTPUT
            System.String
    #>
    [CmdletBinding()]
    param(
        [Parameter(
            Mandatory = $true,
            Position = 0,
            ValueFromPipeline = $true
        )]
        [String[]]
        $FilePath,
 
        [Parameter(
            Mandatory = $true,
            Position = 1
        )]
        [String]
        $StreamName
    )
 
    Process
    {
        if($StreamName -eq 'All')
        {
            try
            {
                # Read all streams
                Get-Content -Path $FilePath -Stream $StreamName
            }
            catch
            {
                Write-Output "No alternate data streams were located in $FilePath.";
            }
        }
        else
        {
            try
            {
                # Read all streams
                Get-Content -Path $FilePath -Stream $StreamName
            }
            catch
            {
                Write-Output "No alternate data streams were located in $FilePath.";
            }
        }
    }
} # end function Read-ADSStream